<template>
  <div class="conitainer">
    <top-Title
      :titleText="`重大事件详情`"
      :back="true"
      @gobackTriser="goBack"
    ></top-Title>
    <div class="mainCon">
      <el-form
        :model="formData"
        ref="formData"
        label-width="130px"
        class="demo-formData"
      >
        <table cellspacing="0" cellpadding="0" class="detailTable">
          <tbody>
            <tr>
              <td class="title">事件类型</td>
              <td>{{ formData.typeName || '--' }}</td>
              <td class="title">项目名称</td>
              <td>{{ formData.projectName || '--' }}</td>
            </tr>
            <tr>
              <td class="title">事件原因</td>
              <td colspan="3">{{ formData.accidentName || '--' }}</td>
            </tr>
            <tr>
              <td class="title">事件时间</td>
              <td>{{ formData.accidentDate || '--' }}</td>
              <td class="title">事件发生地区</td>
              <td>{{ formData.address || '--' }}</td>
            </tr>
            <tr>
              <td class="title">事件程度</td>
              <td v-if="formData.accidentRank == '一般'" class="general">
                {{ formData.accidentRank || '--' }}
              </td>
              <td v-else-if="formData.accidentRank == '重大'" class="import">
                {{ formData.accidentRank || '--' }}
              </td>
              <td v-else-if="formData.accidentRank == '严重'" class="serious">
                {{ formData.accidentRank || '--' }}
              </td>
              <td class="title">责任主体社会信用代码</td>
              <td>{{ formData.uscc || '--' }}</td>
            </tr>
            <tr>
              <td class="title">涉及人员</td>
              <td>{{ formData.involvedRangeName || '--' }}</td>
              <td class="title">责任主体企业名称</td>
              <td>{{ formData.companyName || '--' }}</td>
            </tr>
            <tr v-if="isAddType">
              <td class="title">事件类别</td>
              <td colspan="3">{{ formData.disputeType || '--' }}</td>
            </tr>
            <tr>
              <td class="title">事件情况</td>
              <td colspan="3">{{ formData.illustration || '--' }}</td>
            </tr>
            <tr>
              <td class="title">上传事件资料</td>
              <td colspan="3">
                <template v-for="(item, index) in formData.file">
                  <div class="interval" :key="index">
                    <a
                      target="_blank"
                      class="a_link mouseOn"
                      :href="item.url"
                      >{{ item.originalName || '--' }}</a
                    >
                  </div>
                </template>
              </td>
            </tr>
            <tr>
              <td class="title">添加人</td>
              <td>{{ formData.creatorName || '--' }}</td>
              <td class="title">添加时间</td>
              <td v-if="formData.createTime">
                {{ common.GMTFormat(formData.createTime, true) || '--' }}
              </td>
            </tr>
          </tbody>
        </table>
      </el-form>
    </div>
  </div>
</template>
<script>
import common from '@/kits/common'
import topTitle from '@/components/publicCom/topTitle'

export default {
  name: '',
  components: {
    topTitle,
  },
  data() {
    return {
      formData: {},
    }
  },
  methods: {
    getDetail(id) {
      this.axios({
        method: 'post',
        url: 'api-r/rightsaccident/expand/detailbycompany',
        data: {
          id: id,
        },
      })
        .then((response) => {
          this.formData = response.data.result
        })
        .catch((error) => {
          console.log(error)
        })
    },

    goBack() {
      this.$router.push('/home/illegal/bigEvent')
      this.$store.commit('CHANGE_SLIDER_NAME', {
        oldUrl: '/home/illegal/bigEvent',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
  },
  mounted() {
    this.id = this.$route.query.id
    this.getDetail(this.id)
  },
  activated() {
    this.id = this.$route.query.id
    this.getDetail(this.id)
  },
}
</script>
<style lang="less" scoped>
.container {
  .mainCon {
    height: calc(100% - 67px);
    padding: 24px;
    overflow-y: auto;
    color: #333;
    font-size: 14px;
  }
}
form.el-form.demo-formData {
  width: 100%;
  display: inline-block;
  text-align: left;
  .a_link {
    color: #00a0e9;
  }
  table {
    // width: 100%;
    // border-top: 1px solid #d5dfe8;
    // border-left: 1px solid #d5dfe8;
    // td{
    //   height: 41px;
    //   line-height: 42px;
    //   padding: 0 18px;
    //   border-bottom: 1px solid #d5dfe8;
    //   border-right: 1px solid #d5dfe8;
    // }
    // .title{
    //   width: 177px;
    //   background-color: #f5f7fc;
    //   font-weight: 500;
    //   text-align: right;
    // }
    .general {
      color: #6dd400;
    }
    .import {
      color: #fa6400;
    }
    .serious {
      color: #e02020;
    }
  }
}
.el-main .el-form-item {
  margin-bottom: 20px;
}
</style>
